Allow build script feedback to the crate compiled
authorAlex Crichton <alex@alexcrichton.com>
Thu, 9 Apr 2015 21:35:48 +0000 (14:35 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 14 Apr 2015 17:15:31 +0000 (10:15 -0700)
commit61a0ace4b02a28977173feb66d082b2916a6d46a
tree630260b46e2cd5933de3fecdb4f78035bc5a6627
parent67bc575c3b42a480999aec580a8e4e64ae0d850a
Allow build script feedback to the crate compiled

This commit enables the build script for a crate to provide feedback to the
crate itself about how it should be built. This is done through the `--cfg`
flags of the compiler, and each build script is now allowed to print `rustc-cfg`
directives to inform Cargo about what `--cfg` flags it should pass.

All `--cfg` flags are local to the current crate and are not propagated outwards
to transitive dependencies. The primary use-case that this feature is targeting
is compile-time feature detection for applications like C bindings or C
libraries where the version being targeted may change over time.

Closes #1478
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/mod.rs
src/doc/build-script.md
tests/test_cargo_compile_custom_build.rs